<template>
	<view class="page">
		<!-- #ifndef MP-WEIXIN-->
			<my-navbar leftText="记录详情"  @leftClick="back" ></my-navbar>
		<!-- #endif -->
		<view class="content">
			<view class="good">
				<image class="img" :src="info.pic" mode="aspectFit"></image>
				<view class="right">
					<view class="title">{{info.name}}</view>
					<view class="detail">
						<text class="text">数量：{{info.num_count}}</text>
						<text class="text">合计：<text style="color:#E84B4B">￥{{info.total}}</text></text>
					</view>
				</view>
			</view>
			<view class="list_box">
				<view class="list" v-for="(item,index) in dataList" :key="index">
					<view class="date">{{item.send_time}}</view>
					<view class="info flex-btw">
						<view class="num">
							<text class="text">数量：{{item.nums}}</text>
							<text v-show="canshowprice">单价：￥{{item.price}}</text>
						</view>
						<view class="total" v-show="canshowprice">小计：￥{{item.subtotal}}</view>
					</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	import {$https} from '@/static/js/request.js';
	import MixinShowprice from '@/static/js/mixinshowprice.js'
	export default {
		data() {
			return {
				info:{},
				dataList:[]
			};
		},
		mixins:[MixinShowprice],
		onLoad(option){
			this.params = option;
			this.getData(option.id);
		},
		methods:{
			getData(id){
				$https('GET','purchaseRecordDetail',this.params,res=>{
					if(res.data.errcode==0){
						this.info = res.data.data.goods_info;
						this.dataList = res.data.data.list;
					}else{
						uni.showToast({
							title: res.data.errmsg,
							icon:'none'
						});
					}
				})
			},	
			back(){
				// #ifdef H5
					window.history.back(-1);
				// #endif 
				// #ifndef H5
					uni.navigateBack();
				// #endif
			},
		}
	}
</script>

<style lang="scss">
.page{
	.content{
		padding:0 25rpx;
		.good{
			display: flex;
			align-items: center;
			background:#fff;
			box-sizing: border-box;
			padding:30rpx 20rpx;
			border-radius:10rpx;
			margin-top:20rpx;
			.img{
				width:120rpx;
				height:120rpx;
				margin-right:20rpx;
			}
			.right{
				flex:1;
				height:120rpx;
				display: flex;
				flex-direction: column;
				justify-content: space-around;
				.detail{
					color:#C0C0C0;
					.text{
						display: inline-block;
						width:50%;
					}
				}
			}
		}
		.list{
			margin-top:20rpx;
			font-size: 24rpx;
			color:#9A9A9A;
			.date{
				font-size: 32rpx;
				color:#191919;
				line-height: 80rpx;
			}
			.info{
				padding:8rpx 0;
				border-bottom:1px solid #ECECEC;
				.num{
					flex:1;
					.text{
						display: inline-block;
						width:35%;
					}
				}
			}
		}
	}
}
</style>
